﻿public class ZQueenModel : EventSub
{
    public bool isQueening;
    //已经加载的个数
    private int loadedNum;

    public float Progress { get; private set; }
    public int TotalFileNum { get; set; }

    public ZQueenModel()
    {
        Reset();
    }

    public void ChildEnd(ZLoader loader)
    {
        loadedNum++;
        Progress = loadedNum * (1f / TotalFileNum);
        BroadEvent(new EventArg(ConstData.CHILD_COMPLETE, loader));
    }

    public void End()
    {
        BroadEvent(new EventArg(ConstData.COMPLETE));
        Reset();
    }

    public void OnProgress(float percent)
    {
        Progress = (loadedNum + percent) * (1 / TotalFileNum);
        BroadEvent(new EventArg(ConstData.CHANGE));
    }

    public void Reset()
    {
        isQueening = false;
        TotalFileNum = 0;
        Progress = 0;
        loadedNum = 0;
    }
}